//package com.example.springbootschedule.config;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.SchedulingConfigurer;
//import org.springframework.scheduling.config.ScheduledTaskRegistrar;
//import org.springframework.scheduling.support.CronTrigger;
//
//import java.util.Date;
//
//@Configuration
//@Slf4j
//public class ScheduleConfig implements SchedulingConfigurer {
//    @Override
//    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
//        taskRegistrar.addTriggerTask(
//                () -> {System.out.println("每5秒执行一次");},
//                triggerContext -> {
//                    CronTrigger trigger = new CronTrigger("0/5 * * * * ?");
//                    return Date.from(trigger.nextExecutionTime(triggerContext).toInstant()).toInstant();
//                }
//        );
//    }
//}
